package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.DTO.SignInVO;
import com.ruoyi.framework.web.service.SigninService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//签到
@RestController
@RequestMapping("/sign/in")
public class SignInController extends BaseController {
    @Autowired
    SigninService signinService;

    @GetMapping("/save/{userId}")
    public AjaxResult save(@PathVariable Long userId) {
        signinService.signIn(userId);
        return success();
    }

    @GetMapping("/getSignInRecord/{userId}")
    public AjaxResult getSignInRecord(@PathVariable Long userId) {
        SignInVO signInRecordList = signinService.selectSignInRecordList(userId);
        return success().put("signInRecordList", signInRecordList);
    }
}
